<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/include.inc.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<div class="pageHeader">
	<form id="pagerForm" onsubmit="return validateCallback(this);" action="system/modify"
		method="post">
		<input type="hidden" name="key" value=""/>
		<input type="hidden" name="value" value=""/>
	</form>
</div>

<div class="pageContent">
	<table class="table" width="100%" layoutH="180">
		<thead>
			<tr>
				<th width="40">序号</th>
				<th width="80">名称</th>
				<th width="80">值</th>
				<th width="40">操作</th>
			</tr>
		</thead>
		<tbody>
			<%
				int i = 0;
			%>
			<c:forEach var="conf" items="${configMap}">
				<tr id="conf<%=i%>">
					<td><%=++i%></td>
					<td><c:out value="${conf.key}"></c:out></td>
					<td><input type="text" value="${conf.value }" style="width: 250px;"/></td>
					<td><a href="javascript:saveChange('#conf<%=i-1%>')">保存</a></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
</div>

<script>
	function saveChange(id){
		var form=$("#pagerForm");
		var key=$(id).children().eq(1).children().first().text();
		var value=$(id).children().eq(2).children().first().children("input").eq(0).val();
		//设置表单值
		$("input[name='key']").attr("value", key);
		$("input[name='value']").attr("value", value);
		form.submit();
	}
</script>